<?php
/**
 * @user: leo
 * @date: 2021/6/17
 * @createTime: 14:21
 * @company: 迈酷网络科技 http://www.maicooit.com
 */
namespace app\admin\model;

use think\Model;

class RulesData extends Model{
    //列表
    public function RulesDataListModel($key,$domain_id,$page,$pagesize){
        $list = $this->alias('d')
            ->where('domain_id','=',$domain_id)
            ->field('*')
            ->paginate([
                'list_rows'=> $pagesize,
                'var_page' => 'page',
                'page'=>$page
            ]);
        return $list;
    }
    //新增
    public function RulesDataInsertModel($role_info){
        return $this->insertGetId($role_info);
    }
    //保存
    public function RuleDataSaveModel($role_id,$role_info){
        $where[] = ['role_id','=',$role_id];
        $res = $this->where($where)->save($role_info);
        return $res;
    }
    //禁用_启用
    public function RulesDataDisableEableModel($role_id){
        $where[] = ['role_id','=',$role_id];
        $data['status'] = -1;
        $res = $this->where($where)->save($data);
        return $res;
    }
    //删除
    public function RulesDataDelModel($role_id){
        $where[] = ['role_id','=',$role_id];
        $res = $this->where($where)->delete();
        return $res;
    }
}